package com.liyuncong.algorithm.algorithm_kmeans.entity;

import java.nio.charset.Charset;
import java.util.List;

import com.liyuncong.algorithm.algorithm_kmeans.util.VectorsUtil;
import com.liyuncong.algorithm.algorithm_similarity.entity.Vector;

public class Vectors {
	private List<Vector> vectorList;

	public Vectors(List<Vector> vectorList) {
		this.vectorList = vectorList;
	}
	
	public Vectors(String fileName) {
		this.vectorList = VectorsUtil.loadVectorList(fileName);
	}
	
	public Vectors(String fileName, Charset charset) {
		this.vectorList = VectorsUtil.loadVectorList(fileName, charset);
	}

	public List<Vector> getVectorList() {
		return vectorList;
	}
	
	public int size() {
		return this.vectorList.size();
	}
	
	/**
	 * 获得向量集中的第i个向量
	 * @param index
	 * @return
	 */
	public Vector ValueOf(int index) {
		return this.vectorList.get(index);
	}
}
